package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;

/**
 * 审批类型表
 */
@Entity
@Table(name = "cucheck_type", schema = "springboot", catalog = "")
public class CucheckType {
    private int cutId;          //类型id
    private String cutName;     //类型名称
    private Collection<Cucheck> cuchecksByCutId;
    private Collection<Expense> expenseByCutId;

    @Id
    @Column(name = "cut_id")
    public int getCutId() {
        return cutId;
    }

    public void setCutId(int cutId) {
        this.cutId = cutId;
    }

    @Basic
    @Column(name = "cut_name")
    public String getCutName() {
        return cutName;
    }

    public void setCutName(String cutName) {
        this.cutName = cutName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CucheckType that = (CucheckType) o;
        return cutId == that.cutId &&
                Objects.equals(cutName, that.cutName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(cutId, cutName);
    }

    @OneToMany(mappedBy = "cucheckTypeByCutId")
    public Collection<Cucheck> getCuchecksByCutId() {
        return cuchecksByCutId;
    }

    public void setCuchecksByCutId(Collection<Cucheck> cuchecksByCutId) {
        this.cuchecksByCutId = cuchecksByCutId;
    }

    @OneToMany(mappedBy = "cucheckTypeByCutId")
    public Collection<Expense> getExpenseByCutId() {
        return expenseByCutId;
    }

    public void setExpenseByCutId(Collection<Expense> expenseByCutId) {
        this.expenseByCutId = expenseByCutId;
    }

    @Override
    public String toString() {
        return "CucheckType{" +
                "cutId=" + cutId +
                ", cutName='" + cutName + '\'' +
                '}';
    }
}
